Classes in PHP and JSON

November 30, 2009 · 87 views · 0 comments

Classes in PHP and JSON
taken by : Dedric Mauriac
on Woodbridge (7, 3, 99)

About

I started looking into classes in PHP and found a great way to encapsulate a lot of logic that I am going to use quite often for my grids. In addition, I found a method in PHP that also converts objects into JavaScript Object Notation (JSON) - json_encode($this). It takes a lot of the manual labor out of the equation. PHP's implementation appears to be a little bit more heavier on the encoding and casts property names to strings. I found one problem where I had to recast integers retrieved from a database so that the JSON would represent them as numbers instead of strings. From Dedric Mauriac via bloghud.com